﻿namespace Blaze.Framework
{
    using System.Collections.Generic;

    /// <summary>
    /// dictionary with a key of ValueType will box the value to perform comparison / hash code calculation while scanning the hashtable.
    /// here we implement IEqualityComparer and pass it to your dictionary to avoid that GC
    /// </summary>
    public class DoubleComparer : IEqualityComparer<double>
    {
        #region IEqualityComparer<double> Members

        bool IEqualityComparer<double>.Equals(double x, double y)
        {
            return x == y;
        }

        int IEqualityComparer<double>.GetHashCode(double obj)
        {
            return obj.GetHashCode();
        }

        #endregion
    }
}